﻿using System.Web.Mvc;

namespace ZQNB.Web
{
    /// <summary>
    /// 增加Web架子中的两个搜索路径(Layout, PartialView)
    /// _Ace,_Bs
    /// </summary>
    public class NbViewEngine : RazorViewEngine
    {
        public NbViewEngine()
        {
            AreaViewLocationFormats = new[]
                {
                    "~/Areas/{2}/Views/{1}/{0}.cshtml",
                    "~/Areas/{2}/Views/Shared/{0}.cshtml"
                };

            AreaMasterLocationFormats = new[]
                {
                    "~/Areas/{2}/Views/{1}/{0}.cshtml",
                    "~/Areas/{2}/Views/Shared/{0}.cshtml"
                };

            AreaPartialViewLocationFormats = new[]
                {
                    "~/Areas/{2}/Views/{1}/{0}.cshtml",
                    "~/Areas/{2}/Views/Shared/{0}.cshtml"
                };

            //fixed
            ViewLocationFormats = new[]
                {
                    "~/Views/{1}/{0}.cshtml",
                    "~/Views/Shared/{0}.cshtml", 
                    "~/Areas/Widget/Views/{1}/{0}.cshtml", 
                    "~/Areas/Widget/Views/Shared/{0}.cshtml" 
                };


            MasterLocationFormats = new[]
                {
                    "~/Views/{1}/{0}.cshtml",
                    "~/Views/Shared/{0}.cshtml",
                    "~/Views/Shared/_Ace/{0}.cshtml", 
                    "~/Views/Shared/_Bs/{0}.cshtml"
                };

            //fixed
            PartialViewLocationFormats = new[]
                {
                    "~/Views/{1}/{0}.cshtml",
                    "~/Views/Shared/{0}.cshtml",
                    "~/Views/Shared/_Ace/{0}.cshtml", 
                    "~/Views/Shared/_Bs/{0}.cshtml", 
                    "~/Areas/Widget/Views/{1}/{0}.cshtml", 
                    "~/Areas/Widget/Views/Shared/{0}.cshtml" 
                };

            FileExtensions = new[]
                {
                    "cshtml"
                };

        }
    }
}